<template>
	<view>
		
		<view v-for="item in list" @click="gotoIndex(item.id)" style="width: 90%;margin: 0 auto;margin-top: 50rpx;">
			<view>
				<view > <image :src="item.image" style="width: 100%;height: 300rpx;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;vertical-align: bottom;"></image> </view>
				<view style="background-color: #fff;border-bottom-left-radius: 20rpx;border-bottom-right-radius: 20rpx;padding: 18rpx 20rpx;font-size: 30rpx;color: #707070;">{{item.store_name}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import { getProductList } from '@/api/public.js';
	export default {
		data() {
			return {
				list:[],
			}
		},
		onShow() {
			this.getProductList();
		},
		methods: {
			getProductList(){
				let that = this;
				getProductList().then((res) => {
					that.list = res.data.list
				});
			},
			
			gotoIndex(id){
				
				uni.setStorageSync('top_product_id', id);
				
				uni.switchTab({
					url: '/pages/index/index?id='+id
				});
			},
			
			
		}
	}
</script>

<style>
	page{
		background-color: #e6e6e6;
	}
</style>
